$(function () {
    $("#PublictyModule").addClass("active");

    initNavigation($("#VideoNavigation button"), $("table"), "视频", ".warning", null);

    var videos = $("#tempVideos > div");
    var div = "<div class='row-fluid'></div><hr/>"
    videos.each(function (i) {
        if (i % 4 == 0) {
            $("#videos").append(div);
        }
        $("#videos > div").last().append(videos[i]);
        i++;
    });

    $("#tempVideos").remove();

    $(".span3 a[type='delvideo']").click(function () {
        insertMessageBox($("#videos"), "删除视频操作是不可逆的，您确认要执行此操作吗？", delVideo, $(this));
    });

    function delVideo(btn) {
        var id = btn.parents(".span3").attr("videoid");
        yomsAjaxPost(
            $(".container .row").attr("delete"),
            "videoId=" + id,
            $(this),
            $(".table"),
            function () {
                window.location.href = $(".container .row").attr("find");
            });
    }
});